import React, { Component } from 'react'
import Child from './Child'

export default class Parent extends Component {
  state = {
    salary: 11.46,
    obj: {
      age: 19,
    },
  }
  handleClick = () => {
    // 匈牙利命名法 = 类型 + 含义
    // const oDiv =document.querySelector('div')
    // bBar
    // iNum
    // const aDiv = document.querySelectorAll('div')
    this.setState({
      salary: 8888,
    })
  }
  changeAge = () => {
    console.log(111)
  }
  render() {
    return (
      <div>
        <h3>父：黑马武汉前端 64 期平均工资</h3>
        <button onClick={this.handleClick}>修改 salary</button>
        <hr />

        {/* #1 父组件通过自定义属性提供数据 */}
        <Child
          salary={this.state.salary}
          age='18'
          obj={this.state.obj}
          num={18}
          bBar={true}
          changeAge={this.changeAge}
          jsxEle={<h2>Hello React</h2>}
        />
      </div>
    )
  }
}
